#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    ui->dateTimeEdit_new->displayFormat("yy-")
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
   QDateTime old_datetime = ui->dateTimeEdit_old->dateTime();
   QDateTime new_datetime = ui->dateTimeEdit_new->dateTime();
   int sec = old_datetime.secsTo(new_datetime);
   int day = (sec / 3600) / 24;
   int hour = (sec / 3600) % 24;
   qDebug() << old_datetime << " 到 " << new_datetime << "已经过去 " << day << "天零" << hour << "小时了";

}
